package com.ms.oschina.tagpager;

import android.app.Activity;
import android.os.Bundle;

import com.ms.oschina.R;
import com.ms.oschina.adapter.ViewPagerFragmentAdapter;
import com.ms.oschina.base.BasePagerSlidingTabFragment;
import com.ms.oschina.bean.Constants;
import com.ms.oschina.fragment.NewBlogsFragment;
import com.ms.oschina.fragment.NewInfoFragment;
import com.ms.oschina.util.LogUtils;
import com.ms.oschina.util.UiUtils;

public class NewsFragment extends  BasePagerSlidingTabFragment {

	private Class[] fragments = new Class[] { NewInfoFragment.class,
			NewInfoFragment.class, NewBlogsFragment.class, NewBlogsFragment.class };

	public static final int INFORMATION = 0;
	public static final int HOTSPOT = 1;
	public static final int BLOGS = 2;
	public static final int RECOMMEND = 3;

	private int[] mark = new int[] { INFORMATION, HOTSPOT, BLOGS, RECOMMEND };

	@Override
	public void addTab(ViewPagerFragmentAdapter adapter) {
		String[] titles = UiUtils.getStringArray(R.array.news_viewpage_arrays);

		for (int i = 0; i < titles.length; i++) {
			Bundle args = new Bundle();
			args.putInt(Constants.ARGS, mark[i]);
			adapter.addTab(titles[i], fragments[i], args);
		}
	}

	@Override
	public int offscreenPageLimit() {
		return 4;
	}
}
